package goleetcode

func maxOperations(nums []int) int {
	ans := 1
	sum := nums[0] + nums[1]
	nums = nums[2:]
	if len(nums) < 2 {
		return ans
	}
	if nums[0] + nums[1] != sum {
		return ans
	} else {
		return ans + maxOperations(nums)
	}
}

func maxOperations2(nums []int) int {
	n, t := len(nums), 0
	for i := 1; i < n; i += 2 {
		if nums[i] + nums[i -1] != nums[1] + nums[0] {
			break
		}
		t++
	}
	return t
}